package cn.iver.component;

import cn.ratel.aop.MethodInvocation;
import cn.ratel.component.Enhancers;
import cn.ratel.route.ContextHolder;

import javax.servlet.http.HttpServletRequest;

public class GlobalInterceptor implements Enhancers.Enhancer {

	@Override
	public void enhance(MethodInvocation invocation) {
		HttpServletRequest request = ContextHolder.getRequest().get();
		String userAgent = request.getHeader("User-Agent");
		System.out.println("GlobalInterceptor before --------------------" + userAgent);
		invocation.invoke();
		System.out.println("GlobalInterceptor after --------------------" + userAgent);
	}
}
